UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '216buwHVWgw4jSXQYTkk4cEkiZGj4yoBsKq7MSFiNpw=' 
WHERE 
  key_id = '8236293d57608337986258120c01ede93c1f48bfafe71de9b6c998dbc989c756' 
  AND (
    token = '216buwHVWgw4jSXQYTkk4cEkiZGj4yoBsKq7MSFiNpw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032