UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pAy6WglXj4gC5RICHaORc3FcE0scVpRDG7IfnkCdt6w=' 
WHERE 
  key_id = '7b47c1e6523fa2460eef3abfdc75f378a3d4f72cb3996d64bc389a650ae0ca26' 
  AND (
    token = 'pAy6WglXj4gC5RICHaORc3FcE0scVpRDG7IfnkCdt6w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040