UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'pW6drijzOuv1VUVRXMduSz4R9rBKxl9o2rn92TWzP1U='
WHERE
key_id = '1ea0bf48148378d9194cbda8a3920108112cd2e06ca61a24a5fb0a4dd152f550'
AND (
token = 'pW6drijzOuv1VUVRXMduSz4R9rBKxl9o2rn92TWzP1U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)