UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'RqxPzmCvHkI9HbymSCMNnZ+tYac+kHYNToi4gkajuZc='
WHERE
key_id = '71c3e68048edb03bcb442030440628ac564b2ba09c80990e18457da23f939165'
AND (
token = 'RqxPzmCvHkI9HbymSCMNnZ+tYac+kHYNToi4gkajuZc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)