UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'HiQNxG3ARYARfM6HWAKqXJVtHfH5qhizaIcU7hZ9rkI='
WHERE
key_id = 'c4bacb535410ed4fe6d9f312f26f0f0db62cb8a9ca45532abac3b6868b45a128'
AND (
token = 'HiQNxG3ARYARfM6HWAKqXJVtHfH5qhizaIcU7hZ9rkI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)