UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4uJzExwz6pLx5daKf3V09sNDIv+Fny/raoAv+PMoiKM='
WHERE
key_id = '158c1b29ed2e9b96acaade88b9a396f7b309b625699df65f309575c6351be8ad'
AND (
token = '4uJzExwz6pLx5daKf3V09sNDIv+Fny/raoAv+PMoiKM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)