UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'r27DtnA3/eEgyr+1adeWJCtjXg517KhUfcLu2XFBiFA=' 
WHERE 
  key_id = '731ad0651fcfe18f997171a7a87d5978619fa843c02050d0c29a9a6f9bf61ea8' 
  AND (
    token = 'r27DtnA3/eEgyr+1adeWJCtjXg517KhUfcLu2XFBiFA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047