UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'q2wKn/TR6WLQSrQSomUTJ7LOvBBXt82msFzz7+59A+8='
WHERE
key_id = 'fcc3f12e91cbc416f78a37268c4550d17f6d9ffa07e399bc57fdc6f3f086df16'
AND (
token = 'q2wKn/TR6WLQSrQSomUTJ7LOvBBXt82msFzz7+59A+8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)