UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '478WbTVkit0qBU3XB5Ww6o4IrEJxGP8MbSpZ9fCMSPw='
WHERE
key_id = 'f2ab46b651c237529cfe042ba9837e921fed9f27be35e9744eb0c636f9f35966'
AND (
token = '478WbTVkit0qBU3XB5Ww6o4IrEJxGP8MbSpZ9fCMSPw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)