UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9YUYL23K3QrvdN8f18CizxRN4ZWgzZFMlvRT7UMX9vI=' 
WHERE 
  key_id = 'bd057ba6692ac97c9ad8768a1854996d2930161214ded90ec58239476341ec8e' 
  AND (
    token = '9YUYL23K3QrvdN8f18CizxRN4ZWgzZFMlvRT7UMX9vI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029