UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '17d3nNFEHE+i4Z6txFFw35a7JiuHyZwau26HaYTe6/c=' 
WHERE 
  key_id = '63e483b4ddd0ea12c1f72eed6e0514719557a1495241a235121cadab1fa04c1c' 
  AND (
    token = '17d3nNFEHE+i4Z6txFFw35a7JiuHyZwau26HaYTe6/c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017