UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UrHuOq8w5iq4+JhxpGbo41VcWWSwj53efvLpeoo7bCA='
WHERE
key_id = 'b477a535e6e878fe1106f7c0485d506379e4c51c364520fe4f127b8bdaaecc44'
AND (
token = 'UrHuOq8w5iq4+JhxpGbo41VcWWSwj53efvLpeoo7bCA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)