UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mdXvxmRXujC26TsGuhSNXuZcYn8DLcDtkxABSve0Mw4='
WHERE
key_id = 'be2f7db933101416626ae412d2815717907679ec1ad88f005823f40c6c6252c1'
AND (
token = 'mdXvxmRXujC26TsGuhSNXuZcYn8DLcDtkxABSve0Mw4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)