UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7hr32Dc5MRaad5Xp1yUJ18fDEzQxdalA2ZlfdB6Oar8='
WHERE
key_id = '83c6362ce97ca4920fc738faeda90bdaf4892a971c29c04cc13537cf6395847e'
AND (
token = '7hr32Dc5MRaad5Xp1yUJ18fDEzQxdalA2ZlfdB6Oar8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)