UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4WYbMHqfeWLSdSMJwNAyqOagJhR4DrBirG5m6qRfFd8='
WHERE
key_id = 'fe7dd94d4be9d79a217bd5aed731d7f0198c11a6de6714788be808594abcbe11'
AND (
token = '4WYbMHqfeWLSdSMJwNAyqOagJhR4DrBirG5m6qRfFd8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)