UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WABw0pe6/cKoWloP5FZS4SHKJ7NnanQhXdJYTzLY4Ts=' 
WHERE 
  key_id = '794edd80490581cd911a4b0d4d871c21f79459ed6fb11f80d6310b129f9bcdff' 
  AND (
    token = 'WABw0pe6/cKoWloP5FZS4SHKJ7NnanQhXdJYTzLY4Ts=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046