UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QEhmzFOpKrn3Hre9bXeHcCmYxjihgcCM16YWaxpdYIU='
WHERE
key_id = '12a0846f50e4da33b9bdf3993dc3e64f5ef90090e88c42a9a42b8bd333d316a2'
AND (
token = 'QEhmzFOpKrn3Hre9bXeHcCmYxjihgcCM16YWaxpdYIU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)