UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'iScgxa5ZjPM1dxQxDDTTpQpeJd0o9q4zsyIv+A6AT28='
WHERE
key_id = '704df1a7cd6f6d03d12a974364820a090dac8f05b41914c2cc65df7fe9c79287'
AND (
token = 'iScgxa5ZjPM1dxQxDDTTpQpeJd0o9q4zsyIv+A6AT28='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)