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