UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rU4FqCtQorTfxhYZhWhMs7CKfjjihfy9HeIu0EHUIVM='
WHERE
key_id = '9a84178c2b39f024a99de0a14e99417ec4eb7a341fce25d1dc5706495d4fd8d9'
AND (
token = 'rU4FqCtQorTfxhYZhWhMs7CKfjjihfy9HeIu0EHUIVM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)