UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UWgalee09pA3XHTjNCsQ6V0TrWbhn7fD7b31ZUZgQAw='
WHERE
key_id = '2b31d1e68807eb2afe3912a00923e5c3ca3a18d103a4aa702683ad8fc199eca8'
AND (
token = 'UWgalee09pA3XHTjNCsQ6V0TrWbhn7fD7b31ZUZgQAw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)