UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4DwC0pRYWdtLb/hPvJPtowqDH30PTsKS8WNHZXWRCEY='
WHERE
key_id = 'aa020a15d57cd0e7c24d2281f37782732031ea3617991229783b01001f585295'
AND (
token = '4DwC0pRYWdtLb/hPvJPtowqDH30PTsKS8WNHZXWRCEY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)