UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4nr16BOD63O9snrJhRX4ur9BNVw1cQHVzRQcvtMEHgQ=' 
WHERE 
  key_id = '028bd1bd60ef458f5715cf297e0d25d2d5eb83614c13fb2e28a0d9b40b3e657c' 
  AND (
    token = '4nr16BOD63O9snrJhRX4ur9BNVw1cQHVzRQcvtMEHgQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032