UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'CYuSvzlx0N0R2I67p8onQ0CdL7KAPANcHIXLWRzIHUc=' 
WHERE 
  key_id = 'd4c0ffaac2e8b961e56a5bf042d3ca758a692d10a62b0761ec8ad6abaab19246' 
  AND (
    token = 'CYuSvzlx0N0R2I67p8onQ0CdL7KAPANcHIXLWRzIHUc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018