UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'rdIjhgFpfxFgB+RYsrc6BqDzwSp52bk2ppqnXRzP7e4='
WHERE
key_id = 'c1464bc91ab488b8fd0a9026e3b4013e39c0a1417f252f32c15a8b905103443d'
AND (
token = 'rdIjhgFpfxFgB+RYsrc6BqDzwSp52bk2ppqnXRzP7e4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)