UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'C7MndFtZgwBG4vMIm5Jcva13XTTuiN2nMc4C7Pm+oe0='
WHERE
key_id = '358823ad6536ee8b9032f234cfaaf901552d7d2ef0ffe41ce9ed532689f092be'
AND (
token = 'C7MndFtZgwBG4vMIm5Jcva13XTTuiN2nMc4C7Pm+oe0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)