UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gIHsHRtcQ4CGuqOkbNtshPj6JUONaxYdWe7OCYuDmzw='
WHERE
key_id = 'f345c8ec35c9c26b539b8de9c758cdfb2ee283344712a80cfe9b847e9433e2af'
AND (
token = 'gIHsHRtcQ4CGuqOkbNtshPj6JUONaxYdWe7OCYuDmzw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)