UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C916BfHsKZ1gPOxNHNcYbcUHfDUoytLqD6BIIX88MWE=' 
WHERE 
  key_id = '24d5728872b1b063f5dd0fbbe19ca0fe736c5aa37c68fba6d0d4e43f3757b3f3' 
  AND (
    token = 'C916BfHsKZ1gPOxNHNcYbcUHfDUoytLqD6BIIX88MWE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041