UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hazdkWHk5C1wtxVvf/6njfsDMckygy9LNHey1JZssVw=' 
WHERE 
  key_id = '97708d5cd98496bec0905d7bcf646da3168d627e7744c69297e5b8aa59cef2bb' 
  AND (
    token = 'hazdkWHk5C1wtxVvf/6njfsDMckygy9LNHey1JZssVw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046