UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Kz/+wdniMcvh5c62nDOxBJaBkYRRT2j37+Y076Jbakw=' 
WHERE 
  key_id = '22fcdbc80c39364dc514c9a473b737d71d18e87e78ab5bf8ac6f061ce93288eb' 
  AND (
    token = 'Kz/+wdniMcvh5c62nDOxBJaBkYRRT2j37+Y076Jbakw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042