UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7Y1eZ8hTdswvGlqdytFY68fcYrp4VnwvUH5nwi4Ohxc=' 
WHERE 
  key_id = 'c52563383476f45fcf96124c80fd76ee00cd32f9e3b872649c3a19797d98dce6' 
  AND (
    token = '7Y1eZ8hTdswvGlqdytFY68fcYrp4VnwvUH5nwi4Ohxc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037