UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kPz6gs5GVpHCTlOcITsQNBPMw1B7FL8ftQ1A/KojNJo=' 
WHERE 
  key_id = 'b3cb558f807d04ee7a19db40e23c0038833b4924bd65ca0872c485372a25807b' 
  AND (
    token = 'kPz6gs5GVpHCTlOcITsQNBPMw1B7FL8ftQ1A/KojNJo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047