UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fK9+5L02WCrDGV3UI1sCfClmBGFBZMLAoFQKpcLpNWA=' 
WHERE 
  key_id = 'b4ae15a7fd40fdfc35a3c776145937b6b34cc37288ab9377c38b4d719687611f' 
  AND (
    token = 'fK9+5L02WCrDGV3UI1sCfClmBGFBZMLAoFQKpcLpNWA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052