UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Yq+sLhs3hCEy20mbqYZiPS7KHaGgM8tIYgpgcyr9T2A=' 
WHERE 
  key_id = '496691ccf2c598e6550cad80cc6a8cd7b73920ed26f792319cf175ac184e7a58' 
  AND (
    token = 'Yq+sLhs3hCEy20mbqYZiPS7KHaGgM8tIYgpgcyr9T2A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032