UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4pt9tZoeL9EHTbvd8t+bdB91P76XGs6tIRHe+u+H0uw='
WHERE
key_id = 'e8adb875e35461312009ce0478deb8d779860e9934aec49b97a60e762e9a49a2'
AND (
token = '4pt9tZoeL9EHTbvd8t+bdB91P76XGs6tIRHe+u+H0uw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)