UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TyKWEWy2P36k7KW10jF9S7/IKJhOlYFjfn2klR44+II='
WHERE
key_id = '93e4d6074d73e8e890c39fea828710a87f477189a7a0d796f61f145325a47b49'
AND (
token = 'TyKWEWy2P36k7KW10jF9S7/IKJhOlYFjfn2klR44+II='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)