UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'StwjsvrraKGR/4cOsUfXRFLaFW9Zgcz4siNJB4tiG4M='
WHERE
key_id = '58375f1518a9265f0a45750bffba5cda1682d7b3244ecf699de9d342e2874f53'
AND (
token = 'StwjsvrraKGR/4cOsUfXRFLaFW9Zgcz4siNJB4tiG4M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)