UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Nkqytynl074+Xyv+nErQ52vYm4m9d51hkNFSxEycAwY=' 
WHERE 
  key_id = 'ce43309eaf5e5b27bcde7a7e056de291caec987fc91cadc7bbf981d8364f49a3' 
  AND (
    token = 'Nkqytynl074+Xyv+nErQ52vYm4m9d51hkNFSxEycAwY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00066