UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uAZXG0H+0zDkb1t0G2BxPBw6lqroYar+p333XIuXdZA='
WHERE
key_id = '4a8328ecc1c67c5f60315c9d7547db08aef16ff486502bad456577132d972e4d'
AND (
token = 'uAZXG0H+0zDkb1t0G2BxPBw6lqroYar+p333XIuXdZA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)