UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2Ww+gA4gG/NLbtnFJt9nv9B4xirnJCuSjbKejxJo2cY='
WHERE
key_id = 'c2d465b9a61af00c4e8ece5d7d15e1cd4f2f4ec4c0ccff1de51b28a54c9ccef7'
AND (
token = '2Ww+gA4gG/NLbtnFJt9nv9B4xirnJCuSjbKejxJo2cY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)