UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '78cdubHBB/B0zOia7cPAv03+niiVOb784/pm+1VBtIA='
WHERE
key_id = '2f139656e695bd2c904a8720d4b0149353f649b8f9e48522dab8b427f203d59b'
AND (
token = '78cdubHBB/B0zOia7cPAv03+niiVOb784/pm+1VBtIA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)