UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wgr1JrTTdlcssr3lBEkf8T2/na0SdgNl7D1zgRv2BQ8=' 
WHERE 
  key_id = '097857a7ba3ef6b5c29ccf5a2bae6368496db40e507855c26b40981189d601b8' 
  AND (
    token = 'wgr1JrTTdlcssr3lBEkf8T2/na0SdgNl7D1zgRv2BQ8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033