UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'e6/1cJ0yWzgoDrTVvrmJ58FUSDRrmIhFG4KAZq6zPu8=' 
WHERE 
  key_id = '018992bf116046886e24c3b7421a5076b56e7c9a57cb5faf02d0c402780e4ef8' 
  AND (
    token = 'e6/1cJ0yWzgoDrTVvrmJ58FUSDRrmIhFG4KAZq6zPu8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030