UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eWSUXYd9ThVr6OQ1N1PCjesz4xpMVbeZGN44v2QIiBs=' 
WHERE 
  key_id = '49e095f723c2c02df682d3196c89d283348d9baaba9920e69ec13235cf874b03' 
  AND (
    token = 'eWSUXYd9ThVr6OQ1N1PCjesz4xpMVbeZGN44v2QIiBs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042