UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n7qTTg+EVulsgKtN6IM0VHtyahh8TW6fuxUh9Gakp4w=' 
WHERE 
  key_id = '5b5a6d2a5c657289ec78bd1b7e515e5f280afbbc3eb34ffbea971904de7a611e' 
  AND (
    token = 'n7qTTg+EVulsgKtN6IM0VHtyahh8TW6fuxUh9Gakp4w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00019