UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lmjEHNk5VCU+6g50MF1C2p7Dj4T/SjNRzcuk6Opwk6U=' 
WHERE 
  key_id = 'd306c80754309be768718a574812fb1db0c840822fdced9db2bd39b500db091b' 
  AND (
    token = 'lmjEHNk5VCU+6g50MF1C2p7Dj4T/SjNRzcuk6Opwk6U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027