UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sPCCV7ObOjbxWMCjRDMB4ed+5T2OxG9jEVYYPKUvNa0=' 
WHERE 
  key_id = '35f618c55f6de5f1bd3d292897b8bbe6cfee7f1d75055bef67d5d7433e2fe033' 
  AND (
    token = 'sPCCV7ObOjbxWMCjRDMB4ed+5T2OxG9jEVYYPKUvNa0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032