UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aWYOqlwSAe6gQTo2zu2L/F51nQhs/ovizZ/bBTeiq2Y=' 
WHERE 
  key_id = '2d491c98e0954820839fa885995761a66beb634d1c122f94d6745f05868b39a7' 
  AND (
    token = 'aWYOqlwSAe6gQTo2zu2L/F51nQhs/ovizZ/bBTeiq2Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026