UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5lNKg5sp/GDQsrWo5q+m0/94cJQwZZ1qYafHuixhfrs=' 
WHERE 
  key_id = 'd39b3ff427cb53ca217a7cc4df7adffb7e11d17c7425411cef3323054b0d3a2e' 
  AND (
    token = '5lNKg5sp/GDQsrWo5q+m0/94cJQwZZ1qYafHuixhfrs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036