UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ViW9cLj6gQDBdNfIce1ilLcY/aWJNB3pGLzCyG+mmFQ='
WHERE
key_id = 'c43fe24b6ee0d825e4fbab0e1e6467c07d4dccc820ccd93e84bbfe29ac4d677f'
AND (
token = 'ViW9cLj6gQDBdNfIce1ilLcY/aWJNB3pGLzCyG+mmFQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)