UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IT66eOrDZ8vA2Mkdr/6Vebh1dui3NLHvtHijYJ1OFL8=' 
WHERE 
  key_id = 'c59a66f993e7b0552cfa136fd04b8b79766c8b0a940e295cf397e96997780ab4' 
  AND (
    token = 'IT66eOrDZ8vA2Mkdr/6Vebh1dui3NLHvtHijYJ1OFL8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026