UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wSaJoMzd/i/VYYQBJH/LSficSoUSOfgAkhwtubC3d+4=' 
WHERE 
  key_id = '5666fe5ece77cfec5f2f33d7f2824d9d7cfdb9e1845090dfda9c7f900fb2e487' 
  AND (
    token = 'wSaJoMzd/i/VYYQBJH/LSficSoUSOfgAkhwtubC3d+4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040