UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yoIiSfIQiaPu6Odzq9dqvHydW5e+DkdsyqFFtD+x6Tc='
WHERE
key_id = 'af5c35960b353c08d9c57ff98c46e2f9837cd484c53249ef9926e62160eb7765'
AND (
token = 'yoIiSfIQiaPu6Odzq9dqvHydW5e+DkdsyqFFtD+x6Tc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)