UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CXhfSKusM/hUw6xiB+myj/c/J7glNZA5XBt72xNq9Xk='
WHERE
key_id = '98edfe49fc0b34e7543d236e9e94c11b1a51af8074b3549d31bdf7565bf538cf'
AND (
token = 'CXhfSKusM/hUw6xiB+myj/c/J7glNZA5XBt72xNq9Xk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)