UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qC7aGKfkDiPItaTzLFYdKRB7xtmSE5t9CwzzS2SiiO4='
WHERE
key_id = '63b09de4a23cf574fc44d9dafa125bf8816a5a296815689e579f3d5430b77e35'
AND (
token = 'qC7aGKfkDiPItaTzLFYdKRB7xtmSE5t9CwzzS2SiiO4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)