UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '91NhB9HyJpTtiTAjFrTHvuBMoEy4dzYYugVnXDuLEmU='
WHERE
key_id = 'f84ca1c013ca990d7f5681eebbfa87f52928d4f3e35862dfc91302f193cf9bc6'
AND (
token = '91NhB9HyJpTtiTAjFrTHvuBMoEy4dzYYugVnXDuLEmU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)