UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QoxMOY56Xo3HDe2VWrZlMEazzHDrJE4x37mjZ0PQoy8=' 
WHERE 
  key_id = '2324a6f4ffe288b6a5f22a8a17fd70d51b9a71a96899b0114c906e84eac2c7a7' 
  AND (
    token = 'QoxMOY56Xo3HDe2VWrZlMEazzHDrJE4x37mjZ0PQoy8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017