UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KapGY0ddrkBEpn6dVGE50xEbX7ySsPcMqq0ljktzDXs='
WHERE
key_id = '80f79d909de9058c507c6129dca282e9d3efad5a245434991363ece342bb2dfd'
AND (
token = 'KapGY0ddrkBEpn6dVGE50xEbX7ySsPcMqq0ljktzDXs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)