UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2BijuKPlBSWbQL+HqF2XAMafg+3+0NqX5lSvIWJuwsE=' 
WHERE 
  key_id = '09ba0c4986885ad88afec8ac09cecb8ab3e8a1780d1ee35132ceaeee2cb7a245' 
  AND (
    token = '2BijuKPlBSWbQL+HqF2XAMafg+3+0NqX5lSvIWJuwsE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026