UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MUePT5WEb04ll05Yi7oH/LvAaejfybgc+vq7tuV5Mfc='
WHERE
key_id = 'd0b563c9cf9a129735236bf0310c3b3f5de7003376d3c32c9e05c15c9ebcd2b7'
AND (
token = 'MUePT5WEb04ll05Yi7oH/LvAaejfybgc+vq7tuV5Mfc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)