UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fBZzw8VC/4TB1BQ20acY8AgpI16/OhGCB2Pvi+cAFBo=' 
WHERE 
  key_id = '6a0978f3121c55bcceb92a42aa872381cd73e9e7ea650d61adfb706b742322f1' 
  AND (
    token = 'fBZzw8VC/4TB1BQ20acY8AgpI16/OhGCB2Pvi+cAFBo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038